From c2449763ce2e56cd62e610ecc864250d625b6e7c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 30 Jun 2011 19:18:26 -0400 Subject: [PATCH] Fix up docs for predefined style classes. The table was incomplete and out of date. Instead, just put a list of links in that place, and move all the extra documentation to the macros. Bug 653785 --- docs/reference/gtk/gtk3-sections.txt | 5 + gtk/gtkstylecontext.c | 202 ++++++--------------------- gtk/gtkstylecontext.h | 150 ++++++++++++++++---- 3 files changed, 174 insertions(+), 183 deletions(-) diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index f0654c3c16..9e053f31ef 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -5547,18 +5547,23 @@ GTK_STYLE_CLASS_PROGRESSBAR GTK_STYLE_CLASS_SPINNER GTK_STYLE_CLASS_TOOLBAR GTK_STYLE_CLASS_PRIMARY_TOOLBAR +GTK_STYLE_CLASS_INLINE_TOOLBAR GTK_STYLE_CLASS_PANE_SEPARATOR GTK_STYLE_CLASS_SEPARATOR +GTK_STYLE_CLASS_SIDEBAR GTK_STYLE_CLASS_DND GTK_STYLE_CLASS_ERROR GTK_STYLE_CLASS_EXPANDER GTK_STYLE_CLASS_FRAME GTK_STYLE_CLASS_HIGHLIGHT +GTK_STYLE_CLASS_IMAGE GTK_STYLE_CLASS_INFO GTK_STYLE_CLASS_MARK GTK_STYLE_CLASS_NOTEBOOK GTK_STYLE_CLASS_QUESTION GTK_STYLE_CLASS_SCALE +GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE +GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW GTK_STYLE_CLASS_SPINBUTTON GTK_STYLE_CLASS_VIEW GTK_STYLE_CLASS_WARNING diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 7219ac8659..93a3defb2f 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -177,164 +177,50 @@ * Widgets can add style classes to their context, which can be used * to associate different styles by class (see ). Theme engines can also use style classes to vary their * rendering. GTK+ has a number of predefined style classes: - * - * - * - * - * Style class - * Macro - * Used by - * - * - * - * - * button - * GTK_STYLE_CLASS_BUTTON - * #GtkButton, #GtkToggleButton, #GtkRadioButton, #GtkCheckButton - * - * - * default - * GTK_STYLE_CLASS_DEFAULT - * #GtkButton - * - * - * check - * GTK_STYLE_CLASS_CHECK - * #GtkCheckButton, #GtkCheckMenuItem, #GtkCellRendererToggle - * - * - * radio - * GTK_STYLE_CLASS_RADIO - * #GtkRadioButton, #GtkRadioMenuItem, #GtkCellRendererToggle - * - * - * arrow - * GTK_STYLE_CLASS_ARROW - * #GtkArrow - * - * - * calendar - * GTK_STYLE_CLASS_CALENDAR - * #GtkCalendar - * - * - * entry - * GTK_STYLE_CLASS_ENTRY - * #GtkEntry - * - * - * cell - * GTK_STYLE_CLASS_CELL - * #GtkCellRendererToggle - * - * - * menu - * GTK_STYLE_CLASS_MENU - * #GtkMenu, #GtkMenuItem, #GtkCheckMenuItem, #GtkRadioMenuItem - * - * - * expander - * GTK_STYLE_CLASS_EXPANDER - * #GtkExpander - * - * - * tooltip - * GTK_STYLE_CLASS_TOOLTIP - * #GtkTooltip - * - * - * frame - * GTK_STYLE_CLASS_FRAME - * #GtkFrame - * - * - * scrolled-window - * - * #GtkScrolledWindow - * - * - * viewport - * - * #GtkViewport - * - * - * trough - * GTK_STYLE_CLASS_TROUGH - * #GtkScrollbar, #GtkProgressBar, #GtkScale - * - * - * progressbar - * GTK_STYLE_CLASS_PROGRESSBAR - * #GtkProgressBar, #GtkCellRendererProgress - * - * - * slider - * GTK_STYLE_CLASS_SLIDER - * #GtkScrollbar, #GtkScale - * - * - * menuitem - * GTK_STYLE_CLASS_MENUITEM - * #GtkMenuItem - * - * - * popup - * - * #GtkMenu - * - * - * accelerator - * GTK_STYLE_CLASS_ACCELERATOR - * #GtkAccelLabel - * - * - * menubar - * GTK_STYLE_CLASS_MENUBAR - * #GtkMenuBar - * - * - * toolbar - * GTK_STYLE_CLASS_TOOLBAR - * #GtkToolbar - * - * - * dock - * GTK_STYLE_CLASS_DOCK - * #GtkHandleBox - * - * - * notebook - * - * #GtkNotebook - * - * - * background - * GTK_STYLE_CLASS_BACKGROUND - * #GtkWindow - * - * - * rubberband - * GTK_STYLE_CLASS_RUBBERBAND - * - * - * - * header - * GTK_STYLE_CLASS_HEADER - * - * - * - * grip - * GTK_STYLE_CLASS_GRIP - * #GtkWindow - * - * - * spinner - * GTK_STYLE_CLASS_SPINNER - * #GtkSpinner - * - * - * - * + * #GTK_STYLE_CLASS_CELL, + * #GTK_STYLE_CLASS_ENTRY, + * #GTK_STYLE_CLASS_BUTTON, + * #GTK_STYLE_CLASS_CALENDAR, + * #GTK_STYLE_CLASS_SLIDER, + * #GTK_STYLE_CLASS_BACKGROUND, + * #GTK_STYLE_CLASS_RUBBERBAND, + * #GTK_STYLE_CLASS_TOOLTIP, + * #GTK_STYLE_CLASS_MENU, + * #GTK_STYLE_CLASS_MENUBAR, + * #GTK_STYLE_CLASS_MENUITEM, + * #GTK_STYLE_CLASS_TOOLBAR, + * #GTK_STYLE_CLASS_PRIMARY_TOOLBAR, + * #GTK_STYLE_CLASS_INLINE_TOOLBAR, + * #GTK_STYLE_CLASS_RADIO, + * #GTK_STYLE_CLASS_CHECK, + * #GTK_STYLE_CLASS_TROUGH, + * #GTK_STYLE_CLASS_SCROLLBAR, + * #GTK_STYLE_CLASS_SCALE, + * #GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE, + * #GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW, + * #GTK_STYLE_CLASS_HEADER, + * #GTK_STYLE_CLASS_ACCELERATOR, + * #GTK_STYLE_CLASS_GRIP, + * #GTK_STYLE_CLASS_DOCK, + * #GTK_STYLE_CLASS_PROGRESSBAR, + * #GTK_STYLE_CLASS_SPINNER, + * #GTK_STYLE_CLASS_EXPANDER, + * #GTK_STYLE_CLASS_SPINBUTTON, + * #GTK_STYLE_CLASS_NOTEBOOK, + * #GTK_STYLE_CLASS_VIEW, + * #GTK_STYLE_CLASS_SIDEBAR, + * #GTK_STYLE_CLASS_IMAGE, + * #GTK_STYLE_CLASS_HIGHLIGHT, + * #GTK_STYLE_CLASS_FRAME, + * #GTK_STYLE_CLASS_DND, + * #GTK_STYLE_CLASS_PANE_SEPARATOR, + * #GTK_STYLE_CLASS_SEPARATOR, + * #GTK_STYLE_CLASS_INFO, + * #GTK_STYLE_CLASS_WARNING, + * #GTK_STYLE_CLASS_QUESTION, + * #GTK_STYLE_CLASS_ERROR, + * #GTK_STYLE_CLASS_HORIZONTAL, + * #GTK_STYLE_CLASS_VERTICAL. * * * Widgets can also add regions with flags to their context. diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h index 4e3d4d5ed9..661edd0f76 100644 --- a/gtk/gtkstylecontext.h +++ b/gtk/gtkstylecontext.h @@ -154,6 +154,9 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_CELL: * * A CSS class to match content rendered in cell views. + * + * This is used by cell renderers, e.g. in #GtkIconView + * and #GtkTreeView. */ #define GTK_STYLE_CLASS_CELL "cell" @@ -161,6 +164,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_ENTRY: * * A CSS class to match text entries. + * + * This is used by #GtkEntry. */ #define GTK_STYLE_CLASS_ENTRY "entry" @@ -168,6 +173,10 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_BUTTON: * * A CSS class to match buttons. + * + * This is used by #GtkButton and its subclasses, as well + * as various other widget pieces that appear like buttons, + * e.g. the arrows in a #GtkCalendar. */ #define GTK_STYLE_CLASS_BUTTON "button" @@ -175,6 +184,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_CALENDAR: * * A CSS class to match calendars. + * + * This is not used by GTK+ itself, currently. */ #define GTK_STYLE_CLASS_CALENDAR "calendar" @@ -182,6 +193,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_SLIDER: * * A CSS class to match sliders. + * + * This is used by #GtkSwitch and #GtkRange and its subclasses. */ #define GTK_STYLE_CLASS_SLIDER "slider" @@ -196,6 +209,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_RUBBERBAND: * * A CSS class to match the rubberband selection rectangle. + * + * This is used in #GtkIconView and #GtkTreeView. */ #define GTK_STYLE_CLASS_RUBBERBAND "rubberband" @@ -210,6 +225,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_MENU: * * A CSS class to match popup menus. + * + * This is used in #GtkMenu. */ #define GTK_STYLE_CLASS_MENU "menu" @@ -217,6 +234,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_MENUBAR: * * A CSS class to menubars. + * + * This is used in #GtkMenuBar. */ #define GTK_STYLE_CLASS_MENUBAR "menubar" @@ -224,6 +243,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_MENUITEM: * * A CSS class to match menu items. + * + * This is used in #GtkMenuItem and its subclasses. */ #define GTK_STYLE_CLASS_MENUITEM "menuitem" @@ -231,6 +252,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_TOOLBAR: * * A CSS class to match toolbars. + * + * This is used in #GtkToolbar. */ #define GTK_STYLE_CLASS_TOOLBAR "toolbar" @@ -238,6 +261,9 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_PRIMARY_TOOLBAR: * * A CSS class to match primary toolbars. + * + * This should be used for the 'main' toolbar of an application, + * right below its menubar. */ #define GTK_STYLE_CLASS_PRIMARY_TOOLBAR "primary-toolbar" @@ -245,6 +271,10 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_INLINE_TOOLBAR: * * A CSS class to match inline toolbars. + * + * This should be used for toolbars that are used to hold + * actions below lists, as seen e.g. in the left pane of the + * file chooser. */ #define GTK_STYLE_CLASS_INLINE_TOOLBAR "inline-toolbar" @@ -252,6 +282,9 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_RADIO: * * A CSS class to match radio buttons. + * + * This is used in #GtkRadioButton, #GtkRadioMenuItem and + * #GtkCellRendererToggle. */ #define GTK_STYLE_CLASS_RADIO "radio" @@ -259,6 +292,9 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_CHECK: * * A CSS class to match check boxes. + * + * This is used in #GtkCheckButton, #GtkCheckMenuItem and + * #GtkCellRendererToggle. */ #define GTK_STYLE_CLASS_CHECK "check" @@ -266,6 +302,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_DEFAULT: * * A CSS class to match the default widget. + * + * This is used by #GtkButton. */ #define GTK_STYLE_CLASS_DEFAULT "default" @@ -273,6 +311,9 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_TROUGH: * * A CSS class to match troughs, as in scrollbars and progressbars. + * + * This is used in #GtkRange and its subclasses, #GtkProgressBar + * and #GtkSwitch. */ #define GTK_STYLE_CLASS_TROUGH "trough" @@ -287,6 +328,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_SCALE: * * A CSS class to match scale widgets. + * + * This is used in #GtkScale. */ #define GTK_STYLE_CLASS_SCALE "scale" @@ -312,6 +355,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_HEADER: * * A CSS class to match a header element. + * + * This is used for the header in #GtkCalendar. */ #define GTK_STYLE_CLASS_HEADER "header" @@ -319,6 +364,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_ACCELERATOR: * * A CSS class to match an accelerator. + * + * This is used for the accelerator in #GtkAccelLabel. */ #define GTK_STYLE_CLASS_ACCELERATOR "accelerator" @@ -327,83 +374,111 @@ struct _GtkStyleContextClass * * A CSS class to match a raised control, such as a raised * button on a toolbar. + * + * This should be used in conjunction with #GTK_STYLE_CLASS_PRIMARY_TOOLBAR. */ #define GTK_STYLE_CLASS_RAISED "raised" /** * GTK_STYLE_CLASS_GRIP: * - * A widget class defining a resize grip + * A CSS class defining a resize grip. + * + * This is used for the resize grip in #GtkWindow. */ #define GTK_STYLE_CLASS_GRIP "grip" /** * GTK_STYLE_CLASS_DOCK: * - * A widget class defining a dock area + * A CSS class defining a dock area. + * + * This is used by #GtkHandleBox. */ #define GTK_STYLE_CLASS_DOCK "dock" /** * GTK_STYLE_CLASS_PROGRESSBAR: * - * A widget class defining a resize grip + * A CSS class to use when rendering activity as a progressbar. + * + * This is used in #GtkProgressBar and when drawing progress + * inside a #GtkEntry or in #GtkCellRendererProgress. */ #define GTK_STYLE_CLASS_PROGRESSBAR "progressbar" /** * GTK_STYLE_CLASS_SPINNER: * - * A widget class defining a spinner + * A CSS class to use when rendering activity as a 'spinner'. + * + * This is used by #GtkSpinner and #GtkCellRendererSpinner. */ #define GTK_STYLE_CLASS_SPINNER "spinner" /** * GTK_STYLE_CLASS_MARK: * - * A widget class defining marks in a widget, such as in scales + * A CSS class defining marks in a widget, such as in scales. + * + * Used in #GtkScale. */ #define GTK_STYLE_CLASS_MARK "mark" /** * GTK_STYLE_CLASS_EXPANDER: * - * A widget class defining an expander, such as those in treeviews + * A CSS class defining an expander, such as those in treeviews. + * + * Used for drawing expanders in #GtkTreeView, GtkExpander and + * #GtkToolItemGroup. */ #define GTK_STYLE_CLASS_EXPANDER "expander" /** * GTK_STYLE_CLASS_SPINBUTTON: * - * A widget class defining an spinbutton + * A CSS class defining an spinbutton. + * + * This is used in #GtkSpinButton. */ #define GTK_STYLE_CLASS_SPINBUTTON "spinbutton" /** * GTK_STYLE_CLASS_NOTEBOOK: * - * A widget class defining a notebook + * A CSS class defining a notebook. + * + * Used in #GtkNotebook. */ #define GTK_STYLE_CLASS_NOTEBOOK "notebook" /** * GTK_STYLE_CLASS_VIEW: * - * A widget class defining a view, such as iconviews or treeviews + * A CSS class defining a view, such as iconviews or treeviews. + * + * This is used in #GtkTreeView, #GtkIconView, #GtkTextView, + * as well as #GtkCalendar. */ #define GTK_STYLE_CLASS_VIEW "view" /** * GTK_STYLE_CLASS_SIDEBAR: * - * A widget class defining a sidebar + * A CSS class defining a sidebar, such as the left side in + * a file chooser. + * + * This is used in #GtkFileChooser and in #GtkAssistant. */ #define GTK_STYLE_CLASS_SIDEBAR "sidebar" /** * GTK_STYLE_CLASS_IMAGE: * - * A widget class defining an image, such as the icon in an entry. + * A CSS class defining an image, such as the icon in an entry. + * + * This is used when rendering icons in #GtkEntry. */ #define GTK_STYLE_CLASS_IMAGE "image" @@ -411,22 +486,30 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_HIGHLIGHT: * * A CSS class defining a highlighted area, such as headings in - * assistants. + * assistants and calendars. + * + * This is used in #GtkAssistant and #GtkCalendar. */ #define GTK_STYLE_CLASS_HIGHLIGHT "highlight" /** * GTK_STYLE_CLASS_FRAME: * - * A CSS class defining a frame delimiting content, such as GtkFrame - * or the scrolled window frame around the scrollable area. + * A CSS class defining a frame delimiting content, such as + * #GtkFrame or the scrolled window frame around the + * scrollable area. + * + * This is used in #GtkFrame and #GtkScrollbar. */ #define GTK_STYLE_CLASS_FRAME "frame" /** * GTK_STYLE_CLASS_DND: * - * A CSS class for a drag-and-drop indicator + * A CSS class for a drag-and-drop indicator. + * + * This is used when drawing an outline around a potential + * drop target during DND. */ #define GTK_STYLE_CLASS_DND "dnd" @@ -434,6 +517,8 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_PANE_SEPARATOR: * * A CSS class for a pane separator, such as those in #GtkPaned. + * + * Used in #GtkPaned. */ #define GTK_STYLE_CLASS_PANE_SEPARATOR "pane-separator" @@ -441,52 +526,67 @@ struct _GtkStyleContextClass * GTK_STYLE_CLASS_SEPARATOR: * * A CSS class for a separator. + * + * This is used in #GtkSeparator, #GtkSeparatorMenuItem, + * #GtkSeparatorToolItem, and when drawing separators in #GtkTreeView. */ #define GTK_STYLE_CLASS_SEPARATOR "separator" /** * GTK_STYLE_CLASS_INFO: * - * A widget class for an area displaying an informational message, - * such as those in infobars + * A CSS class for an area displaying an informational message, + * such as those in infobars. + * + * This is used by #GtkInfoBar. */ #define GTK_STYLE_CLASS_INFO "info" /** * GTK_STYLE_CLASS_WARNING: * - * A widget class for an area displaying a warning message, - * such as those in infobars + * A CSS class for an area displaying a warning message, + * such as those in infobars. + * + * This is used by #GtkInfoBar. */ #define GTK_STYLE_CLASS_WARNING "warning" /** * GTK_STYLE_CLASS_QUESTION: * - * A widget class for an area displaying a question to the user, - * such as those in infobars + * A CSS class for an area displaying a question to the user, + * such as those in infobars. + * + * This is used by #GtkInfoBar. */ #define GTK_STYLE_CLASS_QUESTION "question" /** * GTK_STYLE_CLASS_ERROR: * - * A widget class for an area displaying an error message, - * such as those in infobars + * A CSS class for an area displaying an error message, + * such as those in infobars. + * + * This is used by #GtkInfoBar. */ #define GTK_STYLE_CLASS_ERROR "error" /** * GTK_STYLE_CLASS_HORIZONTAL: * - * A widget class for horizontally layered widgets. + * A CSS class for horizontally layered widgets. + * + * This is used by widgets implementing #GtkOrientable. */ #define GTK_STYLE_CLASS_HORIZONTAL "horizontal" /** * GTK_STYLE_CLASS_VERTICAL: * - * A widget class for vertically layered widgets. + * A CSS class for vertically layered widgets. + * + * This is used by widgets implementing #GtkOrientable. */ #define GTK_STYLE_CLASS_VERTICAL "vertical" -- 2.30.2